package com.hpe.wx.performance.redis.ctrl;

import java.util.Locale;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.hpe.wx.performance.redis.service.RedisExampleServer;

@Controller
@RequestMapping(value = "/hpe/performance")
public class TestSpringRedisCtrl {
	private static Logger logger = Logger.getLogger(TestSpringRedisCtrl.class.getSimpleName());
	@Autowired
	private RedisExampleServer service;

	@RequestMapping(value = "/testspring", method = RequestMethod.GET)
	public String jmxUrlAdminPage(Locale locale, Model model, String jmxUrl) {
//		model.addAttribute("jmxUrl", "欢迎进入");
//		Set<Tuple> urls = service.getAllJMXURLs();
//		List<KeyValue> jmxUrls = new ArrayList<>();
//		for (Tuple t : urls) {
//			String[] urlName = t.getElement().split("#");
//			jmxUrls.add(new KeyValue(urlName[1], urlName[0]));
//		}
//		model.addAttribute("jmxUrls", jmxUrls);
		return "hpe/performance/jmxUrlAdmin";
	}

	@RequestMapping(value = "/testspringredis", method = RequestMethod.GET)
	public String testPage(Locale locale, Model model, String jmxUrl) {
		//model.addAttribute("jmxUrl", "欢迎进入");
		System.out.println("Test");
		
		System.out.println(service.hashCode());
		service.zAddData("hhxxttxs", 11111111.0, "nwx");
		
		return "hpe/performance/testPage";
	}

}
